<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>  
    <link rel="stylesheet" href="css/pintuer.css">
    <link rel="stylesheet" href="css/admin.css">
    <script src="js/jquery.js"></script>
    <script src="js/pintuer.js"></script>  
        <script src="js/vue.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/server.js" type="text/javascript" charset="utf-8"></script>

</head>
<body>
<form method="post" action="">
  <div class="panel admin-panel" id="app">
    <div class="panel-head"><strong class="icon-reorder"> 问答管理</strong></div>
    <div class="padding border-bottom">
   
    </div>
    <table class="table table-hover text-center">
      <tr>
        <th width="120">ID</th>
        <th>姓名</th>       
        <th>电话</th>
        <th>邮箱</th>
        
        <th width="25%">内容</th>
         <th width="120">问答时间</th>
        <th>操作</th> 
        <th width="10%">回复</th> 
      </tr>  
      
        <tr v-for=" question in  lists">
          <td>
            {{question.id}}</td>
          <td>{{question.user?question.user.nickname:''}}</td>
          <td>{{question.user?question.user.username:''}}</td>
          <td>{{question.contact}}</td>  
               
          <td>{{question.content}}......</td>
          <td>{{question.sendDate}}</td>
          <td><div class="button-group"> <a class="button border-red" href="javascript:void(0)" v-on:click="del(question.id)"><span class="icon-trash-o"></span> 删除</a> </div></td>
          <td><div class="button-group"> <a class="button border-blue" v-bind:href="'reply.html?id='+question.id"><span class="icon-pencil-square-o"></span> 回复</a> </div></td>

        </tr>

      <tr>
        <td colspan="8"><div class="pagelist"> <a href="">上一页</a> <span class="current">1</span><a href="">2</a><a href="">3</a><a href="">下一页</a><a href="">尾页</a> </div></td>
      </tr>
    </table>
  </div>
</form>

</body>


<script type="text/javascript">
	//Hint表示提示对象 ，把提示信息封装到hint对象中
	var vue = new Vue({
		el : '#app',
		data : {
			lists : [],
			web_server:window.web_server,
			web_static_server:this.web_server+"/static/"
		},
		methods : {
			init : function() {
				var _self = this;
				//自定义 一个函数 ，用来查询所有的商品信息，返回Json
				$.get(_self.web_server+"/question/list", function(result) {
					if(result.code=="200"){
						_self.lists = result.data;
					}
				
				}, "json");
			},
			del:function(_id){
				var _self = this;
				if(confirm("您确定要删除吗?")){
					$.get(_self.web_server+"/question/delete",{id:_id}, function(result) {
							if(result.code=="200"){
									window.location.reload();
							}
					
					}, "json");
		
				}
				
			}

		}

	});
	//初始化Vue对象完毕之后，就调用init方法 （一进入页面，就显示数据）
	vue.init();
</script>


</html>